<?php  

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class party extends CI_Controller {
	function __construct()
	{
		parent::__construct();
		if (!$this->ion_auth->logged_in())
	  	{
			redirect('auth/login');
	  	}		
		$this->load->library('form_validation');
		$this->load->model('accounts/accounts_model');
		$this->load->model('accounts/payment_model');
		$this->load->model('accounts/party_model');
		$this->load->library('datatables');		
		
	}
		
	function get(){
		
		echo $this->accounts_model->get_all();
	}	
	
	function party_accounts(){
		$this->data['heads']=$this->party_model->get_head();
		if(count($this->data['heads'])==0){
			$this->data['heads'] = array();
		}
		$meta['page_title'] = "Party Accounts";		
		 $this->load->view('common/header',$meta);
		$this->load->view('accounts/party_accounts/party_accounts',$this->data);
		 $this->load->view('common/footer');

	}
	
	function get_party(){
	    if($_REQUEST['id_head']=='1'){
			$this->data['parties'] = $this->party_model->get_customer($_REQUEST['id_head'])->result();
			$meta['page_title'] ="Parties Accounts Details";
			$this->load->view('accounts/party_accounts/customeraccounts_list',$this->data);
		}else{
			$this->data['parties'] = $this->party_model->get_supplier($_REQUEST['id_head'])->result();
			$meta['page_title'] ="Parties Accounts Details";
			$this->load->view('accounts/party_accounts/supplieraccounts_list',$this->data);
		}
	}
	
	
	function uniquecustomer(){
	    $this->data['parties'] = $this->party_model->uniquecustomer($_REQUEST['id_user'])->result();
		 $this->data['data'] = $this->party_model->getcustomer_deatils($_REQUEST['id_user']);
		 $this->data['counter'] = $_REQUEST['counter'];
		$this->load->view('accounts/party_accounts/uniquecustomer_list',$this->data);
	}
	function uniquesupplier(){
	    $this->data['parties'] = $this->party_model->uniquesupplier($_REQUEST['id_user'])->result();
		 $this->data['data'] = $this->party_model->getsupplier_deatils($_REQUEST['id_user']);
		 $this->data['counter'] = $_REQUEST['counter'];
		$this->load->view('accounts/party_accounts/uniquesupplier_list',$this->data);
	}

	function print_uniquesupplier($id_user){
		$meta['page_title'] = "Party Report";
	    $this->data['parties'] = $this->party_model->uniquesupplier($id_user)->result();
		 $this->data['data'] = $this->party_model->getsupplier_deatils($id_user);
			 $this->load->view('common/print_header',$meta);
		$this->load->view('accounts/party_accounts/print_uniqueparty_list',$this->data);
		 $this->load->view('common/footer');
	}
	
	function print_uniquecustomer($id_user){
		$meta['page_title'] = "Party Report";
	    $this->data['parties'] = $this->party_model->uniquecustomer($id_user)->result();
		 $this->data['data'] = $this->party_model->getcustomer_deatils($id_user);
			 $this->load->view('common/print_header',$meta);
		$this->load->view('accounts/party_accounts/print_uniqueparty_list',$this->data);
		 $this->load->view('common/footer');
	}

	
}
?>